from pom.basepage.basepage import BasePage
from lib.share import *

class TReleaseToStudent(BasePage):
    loc_title = (css,'.page-title')
    loc_submit_to_release = (css,"h3 [type='button'] i")
    loc_pop_submit = (xpath,"//*[@class='modal-footer']/*[2]")
    loc_pop_cancel = (xpath,"//*[@class='modal-footer']/*[1]")
    loc_pop2_submit = (xpath,"//*[@class='bootstrap-dialog-footer-buttons']/*[1]")
    loc_pop2_text = (xpath,"//*[@class='modal-body']/*[@class='bootstrap-dialog-body']/div")

    loc_open_value = "//*[@class='col-lg-12']/*[index1]/div/*[2]/a/i"
    loc_open_status_value = "//*[@class='col-lg-12']/*[index1]/div/*[2]/a"
    open_status_flag = 'aria-expanded'

    loc_method_xpath = xpath
    loc_floor_value_class1 = "//*[@id='collapse_class_1']/div/table/tbody/*[index1]/td/div/label/span"
    loc_floor_value_class2 = "//*[@id='collapse_class_2']/div/table/tbody/*[index1]/td/div/label/span"
    loc_floor_value_gloup1 = "//*[@id='collapse_group_12']/div/table/tbody/*[index1]/td/div/label/span"
    loc_floor_value_gloup2 = "//*[@id='collapse_group_13']/div/table/tbody/*[index1]/td/div/label/span"

    #四个【全选】的集合
    loc_all_choices = (xpath,"//a/*[@class='fa fa-check']")

    def get_box_loc(self,box_index,loc_value):
        return (xpath,loc_value.replace('index1',str(box_index)))

    def get_open_status(self,box_index):
        loc_value = self.loc_open_status_value
        return self.get_attribute(self.get_box_loc(box_index,loc_value),self.open_status_flag)

    def click_box(self,box_index):
        loc_value = self.loc_open_value
        self.click(self.get_box_loc(box_index,loc_value))

